%%%%%%%%%%%%%%%%%%%%%%%
%%
%% Module summary
%%
%% Main authors: 
%% Progress to usefulness: 
%%
%% Main supervisor for chord tree
%% 
%%%%%%%%%%%%%%%%%%%%%%%

-module(chord_sup).
-behaviour(supervisor).
-include("db.hrl").
% OTP interface
-export([start_link/0,start_link/1]).
-export([init/1]).

% OTP
start_link() ->
    io:format("Starting Chord Supervisor\n"),
    supervisor:start_link({local, ?MODULE}, ?MODULE, []).

start_link(Args) ->
    io:format("Starting Chord Supervisor\n"),
    supervisor:start_link({local, ?MODULE}, ?MODULE, Args).

init(State) ->
    {ok, {{one_for_one, 0, 60},
          [{chord_worker_sup, {chord_worker_sup, start_link, []},
           permanent, 5000, supervisor, [chord_worker_sup]},
           {chord, {chord, start_link, [State]},
           permanent, 5000, worker, [chord]}]
         }}.
